com.atlassian.jira.rpc.soap.service
Class ProjectServiceImpl

java.lang.Object
  extended by com.atlassian.jira.rpc.soap.service.ProjectServiceImpl
All Implemented Interfaces:
ProjectService

public class ProjectServiceImpl
extends java.lang.Object
implements ProjectService


Field Summary
private  ApplicationProperties applicationProperties
           
private static java.lang.String AVATAR_DEFAULT_BASE_FILENAME
           
private  AvatarManager avatarManager
           
private static java.lang.String BASE_64_TEXT_ENCODING
           
private  IssueSecurityLevelManager issueSecurityLevelManager
           
private  IssueSecuritySchemeManager issueSecuritySchemeManager
           
private static Logger log
           
private  NotificationSchemeManager notificationSchemeManager
           
private  OutlookDateManager outlookDateManager
           
private  PermissionManager permissionManager
           
private  PermissionSchemeManager permissionSchemeManager
           
private  ProjectComponentManager projectComponentManager
           
private  com.atlassian.jira.bc.project.ProjectService projectService
           
private  RemoteEntityFactory remoteEntityFactory
           
private  UserManager userManager
           
private  VersionService versionService
           
 
Constructor Summary
ProjectServiceImpl(PermissionManager permissionManager, ApplicationProperties applicationProperties, NotificationSchemeManager notificationSchemeManager, PermissionSchemeManager permissionSchemeManager, IssueSecuritySchemeManager issueSecuritySchemeManager, IssueSecurityLevelManager issueSecurityLevelManager, com.atlassian.jira.bc.project.ProjectService projectService, ProjectComponentManager projectComponentManager, VersionService versionService, OutlookDateManager outlookDateManager, UserManager userManager, AvatarManager avatarManager, RemoteEntityFactory remoteEntityFactory)
           
 
Method Summary
(package private)  void addRemoteSchemes(User user, RemoteProject remoteProject, GenericValue project)
           
 void archiveVersion(User user, java.lang.String projectKey, java.lang.String versionName, boolean archive)
           
 RemoteProject createProject(User user, RemoteProject rProject)
           
 RemoteProject createProject(User user, java.lang.String key, java.lang.String name, java.lang.String description, java.lang.String url, java.lang.String lead, RemotePermissionScheme permissionScheme, RemoteScheme notificationScheme, RemoteScheme issueSecurityScheme)
           
(package private)  RemoteAvatar createRemoteAvatar(Avatar a, boolean large, Base64InputStreamConsumer data)
           
 RemoteVersion createVersion(User user, java.lang.String projectKey, RemoteVersion remoteVersion)
           
 void deleteProject(User user, java.lang.String projectKey)
           
 void deleteProjectAvatar(User user, long avatarId)
          Deletes the given custom Avatar from the system.
 RemoteComponent[] getComponents(User user, java.lang.String projectKey)
           
 RemoteAvatar getProjectAvatar(User user, java.lang.String projectKey, java.lang.String size)
          Retrieves the current Avatar for the given project.
 RemoteAvatar[] getProjectAvatars(User user, java.lang.String projectKey, boolean includeSystemAvatars, java.lang.String size)
          Retrieves avatars for the given project.
 RemoteProject getProjectById(User user, java.lang.Long projectId)
          Returns the Project with the matching id (if the user has permission to browse it).
 RemoteProject getProjectByKey(User user, java.lang.String projectKey)
          Returns the Project with the matching key (if the user has permission to browse it).
 RemoteProject[] getProjects(User user, boolean addSchemes)
           
 RemoteProject getProjectWithSchemesById(User user, java.lang.Long projectId)
          Returns the project with the matching id (if the user has permission to browse it) with notification, issue security and permission schemes attached.
private  java.lang.Long getScheduleAfter(User user, Project project, RemoteVersion remoteVersion)
           
 RemoteSecurityLevel[] getSecurityLevels(User user, java.lang.String projectKey)
          Return an array of Security Levels for a given project
private  Version getVersionByProjectAndName(User user, java.lang.String projectKey, java.lang.String versionName)
           
 RemoteVersion[] getVersions(User user, java.lang.String projectKey)
           
 void releaseVersion(User user, java.lang.String projectKey, RemoteVersion remoteVersion)
           
(package private)  Project retrieveProjectById(java.lang.Long id, User user)
           
(package private)  Project retrieveProjectByKey(java.lang.String projectKey, User user)
          Retrieve a single project, throwing an exception if the user has no permissions.
private  Project retrieveProjectForAdministration(User user, long projectId)
           
private  Project retrieveProjectForAdministration(User user, java.lang.String projectKey)
           
 void setProjectAvatar(User user, java.lang.String projectKey, java.lang.Long avatarId)
          Sets the current avatar for the given project to that with the given id.
 void setProjectAvatar(User user, java.lang.String projectKey, java.lang.String contentType, java.lang.String base64ImageData)
          Creates a new custom avatar for the given project and sets it to be current for the project.
 RemoteProject updateProject(User user, RemoteProject rProject)
           
(package private)  com.atlassian.jira.bc.project.ProjectService.UpdateProjectValidationResult validateSetAvatar(User user, Project project, java.lang.Long avatarId)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

permissionManager

private final PermissionManager permissionManager

applicationProperties

private final ApplicationProperties applicationProperties

notificationSchemeManager

private final NotificationSchemeManager notificationSchemeManager

permissionSchemeManager

private final PermissionSchemeManager permissionSchemeManager

issueSecuritySchemeManager

private final IssueSecuritySchemeManager issueSecuritySchemeManager

issueSecurityLevelManager

private final IssueSecurityLevelManager issueSecurityLevelManager

projectService

private final com.atlassian.jira.bc.project.ProjectService projectService

projectComponentManager

private final ProjectComponentManager projectComponentManager

versionService

private final VersionService versionService

outlookDateManager

private final OutlookDateManager outlookDateManager

userManager

private final UserManager userManager

avatarManager

private AvatarManager avatarManager

remoteEntityFactory

private final RemoteEntityFactory remoteEntityFactory

log

private static final Logger log

AVATAR_DEFAULT_BASE_FILENAME

private static final java.lang.String AVATAR_DEFAULT_BASE_FILENAME
See Also:
Constant Field Values

BASE_64_TEXT_ENCODING

private static final java.lang.String BASE_64_TEXT_ENCODING
See Also:
Constant Field Values
Constructor Detail

ProjectServiceImpl

public ProjectServiceImpl(PermissionManager permissionManager,
                          ApplicationProperties applicationProperties,
                          NotificationSchemeManager notificationSchemeManager,
                          PermissionSchemeManager permissionSchemeManager,
                          IssueSecuritySchemeManager issueSecuritySchemeManager,
                          IssueSecurityLevelManager issueSecurityLevelManager,
                          com.atlassian.jira.bc.project.ProjectService projectService,
                          ProjectComponentManager projectComponentManager,
                          VersionService versionService,
                          OutlookDateManager outlookDateManager,
                          UserManager userManager,
                          AvatarManager avatarManager,
                          RemoteEntityFactory remoteEntityFactory)
Method Detail

getProjects

public RemoteProject[] getProjects(User user,
                                   boolean addSchemes)
                            throws RemoteException
Specified by:
getProjects in interface ProjectService
Throws:
RemoteException

getProjectById

public RemoteProject getProjectById(User user,
                                    java.lang.Long projectId)
                             throws RemoteException
Description copied from interface: ProjectService
Returns the Project with the matching id (if the user has permission to browse it).

Specified by:
getProjectById in interface ProjectService
Parameters:
user - the authenticated User attempting to access the project. Permission checks are run against them.
projectId - the id of the requested after project
Returns:
the Project object specified by the id, if it exists and the user has the BROWSE permission for it
Throws:
RemotePermissionException - if the User does not have permission to BROWSE the project.
RemoteException

getProjectWithSchemesById

public RemoteProject getProjectWithSchemesById(User user,
                                               java.lang.Long projectId)
                                        throws RemoteException
Description copied from interface: ProjectService
Returns the project with the matching id (if the user has permission to browse it) with notification, issue security and permission schemes attached.

Specified by:
getProjectWithSchemesById in interface ProjectService
Parameters:
user - the authenticated User attempting to access the project. Permission checks are run against them.
projectId - the id of the requested after project
Returns:
the Project object specified by the id, if it exists and the user has the BROWSE permission for it
Throws:
RemotePermissionException - if the User does not have permission to BROWSE the project.
RemoteException

getProjectByKey

public RemoteProject getProjectByKey(User user,
                                     java.lang.String projectKey)
                              throws RemoteException
Description copied from interface: ProjectService
Returns the Project with the matching key (if the user has permission to browse it).

Specified by:
getProjectByKey in interface ProjectService
Parameters:
user - the authenticated User attempting to access the project. Permission checks are run against them.
projectKey - the key of the requested after project
Returns:
the Project object specified by the key, if it exists and the user has the BROWSE permission for it
Throws:
RemotePermissionException - if the User does not have permission to BROWSE the project.
RemoteException

getComponents

public RemoteComponent[] getComponents(User user,
                                       java.lang.String projectKey)
                                throws RemoteException
Specified by:
getComponents in interface ProjectService
Throws:
RemoteException

getVersions

public RemoteVersion[] getVersions(User user,
                                   java.lang.String projectKey)
                            throws RemoteException
Specified by:
getVersions in interface ProjectService
Throws:
RemoteException

createProject

public RemoteProject createProject(User user,
                                   RemoteProject rProject)
                            throws RemoteException
Specified by:
createProject in interface ProjectService
Throws:
RemoteException

createProject

public RemoteProject createProject(User user,
                                   java.lang.String key,
                                   java.lang.String name,
                                   java.lang.String description,
                                   java.lang.String url,
                                   java.lang.String lead,
                                   RemotePermissionScheme permissionScheme,
                                   RemoteScheme notificationScheme,
                                   RemoteScheme issueSecurityScheme)
                            throws RemoteException
Specified by:
createProject in interface ProjectService
Throws:
RemoteException

updateProject

public RemoteProject updateProject(User user,
                                   RemoteProject rProject)
                            throws RemoteException
Specified by:
updateProject in interface ProjectService
Throws:
RemoteException

deleteProject

public void deleteProject(User user,
                          java.lang.String projectKey)
                   throws RemoteException
Specified by:
deleteProject in interface ProjectService
Throws:
RemoteException

addRemoteSchemes

void addRemoteSchemes(User user,
                      RemoteProject remoteProject,
                      GenericValue project)
                throws GenericEntityException,
                       RemoteException
Throws:
GenericEntityException
RemoteException

retrieveProjectById

Project retrieveProjectById(java.lang.Long id,
                            User user)
                      throws RemoteException
Throws:
RemoteException

retrieveProjectByKey

Project retrieveProjectByKey(java.lang.String projectKey,
                             User user)
                       throws RemoteException
Retrieve a single project, throwing an exception if the user has no permissions.

Throws:
RemoteException

createVersion

public RemoteVersion createVersion(User user,
                                   java.lang.String projectKey,
                                   RemoteVersion remoteVersion)
                            throws RemoteException
Specified by:
createVersion in interface ProjectService
Throws:
RemoteException

getVersionByProjectAndName

private Version getVersionByProjectAndName(User user,
                                           java.lang.String projectKey,
                                           java.lang.String versionName)
                                    throws RemoteException
Throws:
RemoteException

releaseVersion

public void releaseVersion(User user,
                           java.lang.String projectKey,
                           RemoteVersion remoteVersion)
                    throws RemoteException
Specified by:
releaseVersion in interface ProjectService
Throws:
RemoteException

archiveVersion

public void archiveVersion(User user,
                           java.lang.String projectKey,
                           java.lang.String versionName,
                           boolean archive)
                    throws RemoteException
Specified by:
archiveVersion in interface ProjectService
Throws:
RemoteException

getSecurityLevels

public RemoteSecurityLevel[] getSecurityLevels(User user,
                                               java.lang.String projectKey)
                                        throws RemoteException
Description copied from interface: ProjectService
Return an array of Security Levels for a given project

Specified by:
getSecurityLevels in interface ProjectService
Parameters:
user - the authenticated User attempting to access the project. Permission checks are run against them.
projectKey - the key of the requested project
Returns:
array of RemoteSecurityLevel objects for the project. The Array will be empty if the user does not have the Set Security Level permission for the project.
Throws:
RemoteException - If the project key is invalid or the Security Levels could not be retrieved
RemotePermissionException - If the User does not have Browse permission for the project

getProjectAvatars

public RemoteAvatar[] getProjectAvatars(User user,
                                        java.lang.String projectKey,
                                        boolean includeSystemAvatars,
                                        java.lang.String size)
                                 throws RemoteException,
                                        RemotePermissionException
Description copied from interface: ProjectService
Retrieves avatars for the given project. If the includeSystemAvatars parameter is true, this will include both system (built-in) avatars as well as custom (user-supplied) avatars for that project, otherwise it will include only the custom avatars.

Specified by:
getProjectAvatars in interface ProjectService
Parameters:
user - the user whos asking, must have BROWSE permission to the project.
projectKey - the key for the project.
includeSystemAvatars - if false, only custom avatars will be included in the returned array.
size - "large" or "small".
Returns:
the avatars for the project, possibly empty.
Throws:
RemoteException - If the project key is invalid.
RemotePermissionException - If you do not have Browse permission for the project.

setProjectAvatar

public void setProjectAvatar(User user,
                             java.lang.String projectKey,
                             java.lang.String contentType,
                             java.lang.String base64ImageData)
                      throws RemoteException
Description copied from interface: ProjectService
Creates a new custom avatar for the given project and sets it to be current for the project. The image data must be provided as base64 encoded data and should be 48 pixels square. If the image is larger, the top left 48 pixels are taken, if it is smaller it is upscaled to 48 pixels. The small version of the avatar image (16 pixels) is generated automatically.

Specified by:
setProjectAvatar in interface ProjectService
Parameters:
user - the user setting the avatar, must have PROJECT ADMIN permission to the project.
projectKey - the key for the project.
contentType - the MIME type of the image provided, e.g. image/gif, image/jpeg, image/png.
base64ImageData - a base 64 encoded image, 48 pixels square.
Throws:
RemoteException - If the project key is invalid.
RemotePermissionException - If you do not have project admin permission for the project.

setProjectAvatar

public void setProjectAvatar(User user,
                             java.lang.String projectKey,
                             java.lang.Long avatarId)
                      throws RemoteException
Description copied from interface: ProjectService
Sets the current avatar for the given project to that with the given id.

Specified by:
setProjectAvatar in interface ProjectService
Parameters:
user - the user setting the avatar, must have PROJECT ADMIN permission to the project.
projectKey - the key for the project.
avatarId - the id of an existing avatar to use for the project or null for the default avatar.
Throws:
RemoteException - If the project key is invalid.
RemotePermissionException - If you do not have project admin permission for the project.

getProjectAvatar

public RemoteAvatar getProjectAvatar(User user,
                                     java.lang.String projectKey,
                                     java.lang.String size)
                              throws RemoteException,
                                     RemotePermissionException
Description copied from interface: ProjectService
Retrieves the current Avatar for the given project.

Specified by:
getProjectAvatar in interface ProjectService
Parameters:
user - the user whos asking, must have BROWSE permission to the project.
projectKey - the key for the project.
size - "large" or "small".
Returns:
the current avatar for the project.
Throws:
RemoteException - If the project key is invalid.
RemotePermissionException - If you do not have Browse permission for the project.

deleteProjectAvatar

public void deleteProjectAvatar(User user,
                                long avatarId)
                         throws RemoteException
Description copied from interface: ProjectService
Deletes the given custom Avatar from the system. System avatars cannot be deleted.

Specified by:
deleteProjectAvatar in interface ProjectService
Parameters:
user - the user whos asking, must have PROJECT ADMIN permission to the project.
avatarId - id of the custom avatar to delete.
Throws:
RemoteException - if there is no avatar with the given id, or if it is a system avatar.
RemotePermissionException - If you do not have administer permission for the project.

createRemoteAvatar

RemoteAvatar createRemoteAvatar(Avatar a,
                                boolean large,
                                Base64InputStreamConsumer data)

validateSetAvatar

com.atlassian.jira.bc.project.ProjectService.UpdateProjectValidationResult validateSetAvatar(User user,
                                                                                             Project project,
                                                                                             java.lang.Long avatarId)

retrieveProjectForAdministration

private Project retrieveProjectForAdministration(User user,
                                                 long projectId)
                                          throws RemoteException
Throws:
RemoteException

retrieveProjectForAdministration

private Project retrieveProjectForAdministration(User user,
                                                 java.lang.String projectKey)
                                          throws RemoteException
Throws:
RemoteException

getScheduleAfter

private java.lang.Long getScheduleAfter(User user,
                                        Project project,
                                        RemoteVersion remoteVersion)
                                 throws RemoteValidationException
Throws:
RemoteValidationException